 <style>
     opt{
        opacity:0.6;
        margin-right: 10px;
     }
     opt:hover {
         opacity:1;
     }
 </style>
<div class="row-fluid">
    
    <div class="span3">
        
        <?php
//        if( class_exists('ZipArchive') )
//    echo "ZIP: OK\n";
            echo '<h1>'.$this->Html->link(h($project['Project']['name']),'view/'.$project['Project']['id']).'</h1>';
        ?>        
    </div>
    
    <div class="span9"><h3  style="font-weight: 600;">
        <a href="<?php echo $this->base;?>/projects/repository/<?php echo $project['Project']['id'];?>" rel="tooltip" title="Repositorio" style=" color: black;">
        <?php echo $this->Html->image('icons/24x24/inbox.png', array( 'width' => '24px')) ; ?> 
        </a>
        
        <?php if (isset($folderComplete)) {
            
            if (isset($folderComplete['Parent'])) {
                if ($folderComplete['Parent']['Upload']['folder_id']!= 0 ) 
                    echo '>'.$this->Html->link(' ... ','../projects/repository/'.$project['Project']['id'].'/'.$folderComplete['Parent']['Upload']['folder_id']);
                echo '>'.$this->Html->link(h($folderComplete['Parent']['Upload']['filename']),'../projects/repository/'.$project['Project']['id'].'/'.$folderComplete['Parent']['Upload']['id']);
            }
            echo '>'.$this->Html->link(h($folderComplete['Upload']['filename']),'../projects/repository/'.$project['Project']['id'].'/'.$folderComplete['Upload']['id']);
        }
            //var_dump($folderComplete);?>
    </h3></div>
</div>
<div class="row-fluid">
    <div class="span3">
<!--        <a data-toggle="modal" href="#upload" class="btn btn-primary " role="button"  >
            <i class="icon-upload icon-white"></i> Agregar Archivo
        </a>-->
        <?php 
//        echo $this->element('uploads/add')
                ?>
<!--        <br/>
        <a data-toggle="modal" href="#createFolder" class="btn btn-primary " role="button"  >
            <i class="icon-folder-open icon-white"></i> Nuevo Folder
        </a>-->
        <?php 
//        echo $this->element('uploads/createFolder')
                ?>
        
        
        <div class="sidebar-nav navbar-inverse">
            <ul class="nav nav-list">
<!--                <li class="nav-header">Repositorio de Archivos</li>    -->
                <li>
                    <a data-toggle="modal" href="#upload" role="button"  >    
                    <?php echo $this->Html->image('icons/24x24/upload.png', array( 'width' => '16px')) ;?>
<!--                        <i class="icon-upload"></i> -->
                        Agregar Archivo
                    </a>
                    <?php echo $this->element('uploads/add')?>
                            </li>
                <li>
                    <a data-toggle="modal" href="#createFolder" role="button"  >
                    <?php echo $this->Html->image('icons/24x24/folder_plus.png', array( 'width' => '16px')) ;?>
<!--                        <i class="icon-folder-open"></i> -->
                        Nuevo Folder
                    </a>
                    <?php echo $this->element('uploads/createFolder')?>
                </li>
            </ul>
        </div>
    </div>
    <div class="span9">
        <table class="table table-hover">
            <thead>
                <tr class="warning">
                    <th></th>
                    <th>Nombre</th>
                    <th>Tipo</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($uploads as $u): ?>
                <tr>
                    <td>
                        <?php 
                        if (strtolower($u['Upload']['fileextension'])=="")
                           echo $this->Html->image('icons/24x24/folder_open.png', array( 'width' => '16px')) ;
                        elseif (strtolower($u['Upload']['fileextension'])=="xls" || strtolower($u['Upload']['fileextension'])=="xlsx" )
                           echo $this->Html->image('icons/files/excel.png', array( 'width' => '16px')) ;
                        elseif (strtolower($u['Upload']['fileextension'])=="doc" || strtolower($u['Upload']['fileextension'])=="docx" )
                           echo $this->Html->image('icons/files/word.png', array( 'width' => '16px')) ;
                        elseif (strtolower($u['Upload']['fileextension'])=="ppt" || strtolower($u['Upload']['fileextension'])=="pptx" )
                           echo $this->Html->image('icons/files/powerpoint.png', array( 'width' => '16px')) ;
                        elseif (strtolower($u['Upload']['fileextension'])=="jpg" || strtolower($u['Upload']['fileextension'])=="png"|| strtolower($u['Upload']['fileextension'])=="gif" )
                           echo $this->Html->image('icons/files/image.png', array( 'width' => '16px')) ;
                        elseif (strtolower($u['Upload']['fileextension'])=="rar" || strtolower($u['Upload']['fileextension'])=="7zip"||strtolower($u['Upload']['fileextension'])=="zip" )
                           echo $this->Html->image('icons/24x24/sort.png', array( 'width' => '16px')) ;
                        else
                           echo $this->Html->image('icons/32x32/page_question.png', array( 'width' => '16px')) ;
                        ?>
                    </td>
                    <td>
                        <?php 
                        if ($u['Upload']['name']=="")
                            echo $this->Html->link($u['Upload']['filename'], "../projects/repository/".$u['Upload']['project_id'].'/'.$u['Upload']['id']);
                        else    
                            echo $this->Html->link($u['Upload']['filename'], array('controller' => 'uploads','action' => 'download', $u['Upload']['id']));
                        ?>
                    </td>
                    <td><?php 
                        if ($u['Upload']['name']=="")
                            echo "carpeta";
                        else    
                            echo $u['Upload']['fileextension'];
                        ?> 
                    </td>
                    <td>
                        <?php 
                        if ($u['Upload']['name']==""){?> 
                            <opt>
                            <?php echo $this->Form->postLink(
                                $this->Html->image('icons/24x24/circle_remove.png', array( 'width' => '16px')),
                                '../uploads/delete/'.$u['Upload']['id'].'/1',
                                array('confirm' => '¿Está seguro que desea eliminar la carpeta y todos los archivos que contiene?','escape' => false,'rel'=>'tooltip','title'=>'Eliminar Folder'));
                            ?>
                            </opt>
                        <?php    
                        } else {  ?>  
                            <opt><a href="<?php echo $this->base;?>/uploads/download/<?php echo $u['Upload']['id'];?>" rel="tooltip" title="Descargar"  >
                            <?php echo $this->Html->image('icons/24x24/download_alt.png', array( 'width' => '16px')) ; ?> 
                            </a> </opt>
                         
                            <opt>
                            <?php echo $this->Form->postLink(
                                $this->Html->image('icons/24x24/circle_remove.png', array( 'width' => '16px')),
                                '../uploads/delete/'.$u['Upload']['id'].'/1',
                                array('confirm' => '¿Está seguro que desea eliminar el archivo?','escape' => false,'rel'=>'tooltip','title'=>'Eliminar'));
                            ?>
                            </opt>
                        
                        <?php
                        }
                        ?> 
                    </td>
                </tr>
                <?php endforeach; ?>
            </tbody>
         
        </table>
    </div>
</div>






